/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package strategies;

import wrappers.DepartmentWrap;

/**
 *
 * @author KAV
 */
public class DepartmentsAddRowStrategy extends AddRowStrategy {

    @Override
    protected void addRow() {
        isValid = pp.getParam("edit_title").matches("[a-zA-Zа-яА-Я 0-9-]+") && (Integer.parseInt(pp.getParam("edit_country")) != 0);
    }

    @Override
    protected Object createObject() {
        return new DepartmentWrap(0, pp.getParam("edit_title"), Integer.parseInt(pp.getParam("edit_country")));
    }
}
